<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    
    <title><?php echo ($title); ?> <?php echo C('WEB_SITE_TITLE');?></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    
    <script src="/Admin/js/jquery.min.js?v=2.1.4"></script>
    <style>
        .disable{
            display: none;
        }
    </style>

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5><?php echo ($title); ?></h5>
            <!--<div class="ibox-tools">-->
                <!--<a class="collapse-link">-->
                    <!--<i class="fa fa-chevron-up"></i>-->
                <!--</a>-->
                <!--<a class="dropdown-toggle" data-toggle="dropdown" href="#">-->
                    <!--<i class="fa fa-wrench"></i>-->
                <!--</a>-->
                <!--<ul class="dropdown-menu dropdown-user">-->
                    <!--<li><a href="#">选项1</a>-->
                    <!--</li>-->
                    <!--<li><a href="#">选项2</a>-->
                    <!--</li>-->
                <!--</ul>-->
                <!--<a class="close-link">-->
                    <!--<i class="fa fa-times"></i>-->
                <!--</a>-->
            <!--</div>-->
        </div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
    
                    <script>
    $(function(){
        $(".alert").on('click',function(){
            console.log("tap");
            $(this).remove();
        });
    })
</script>
<?php switch($alert["status"]): case "0": ?><div class="alert alert-danger" style="text-align:center;"><?php echo ($alert["msg"]); ?></div><?php break;?>
    <?php case "1": ?><div class="alert alert-success" style="text-align:center;"><?php echo ($alert["msg"]); ?></div><?php break; endswitch;?>
    
                    <div class="clearfix" style="width:100%;">
                        <div class="bars pull-left">
                            <div class="btn-group hidden-xs" id="exampleTableEventsToolbar" role="group">
                                <button type="button" class="btn btn-outline btn-default" href="<?php echo U('Item/index');?>" style="padding-bottom: 8px;padding-top: 8px;">
                                    <i class="glyphicon glyphicon-chevron-left" aria-hidden="true"></i>
                                </button>
                                <button type="button" class="btn btn-outline btn-default" href="<?php echo U('Item/edit');?>" style="padding-bottom: 8px;padding-top: 8px;">
                                    <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
                                </button>
                                <button class="btn btn-default btn-outline" type="button" name="refresh" title="刷新" href="/admin.php/Item/edit.html" style="padding-bottom: 8px;padding-top: 8px;">
                                    <i class="glyphicon glyphicon-repeat"></i>
                                </button>
                                <button type="button" class="btn btn-outline btn-default confirm" href="<?php echo U('Item/delete',['id'=>$info['id']]);?>" style="padding-bottom: 8px;padding-top: 8px;">
                                    <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
                                </button>
                            </div>
                        </div>
                    </div>
    
                    <form method="post" action='<?php if(($_GET["type"]) == "check"): echo U("Item/check"); else: ?>/admin.php/Item/edit.html<?php endif; ?>' class="form-horizontal">
    
                        <?php if(I('get.type','') == 'check'): ?><div class="form-group">
                            <label class="col-sm-2 control-label">审核状态
                                <!--<br><small class="text-navy">自定义样式</small>-->
                            </label>
            
                            <div class="col-sm-10">
                                    <?php $_result=C('ITEM_STATUS');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$status): $mod = ($i % 2 );++$i;?><div class="radio i-checks">
                                            <label>
                                                <input type="radio" value="<?php echo ($key); ?>" name="status" <?php if(($info["status"]) == $key): ?>checked="checked"<?php endif; ?>> <i></i>  <?php echo ($type); echo ($status); ?>
                                            </label>
                                        </div><?php endforeach; endif; else: echo "" ;endif; ?>
                            </div>
                        </div><?php endif; ?>
    
                        <div class="hr-line-dashed"></div>
                        
                        <div class="form-group">
                            <label class="col-sm-2 control-label">审核记录
                            </label>
        
                            <div class="col-sm-10" style="    padding-top: 6px;">
                                <?php if(!empty($info['check_records'])): if(is_array($info["check_records"])): $i = 0; $__LIST__ = $info["check_records"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$record): $mod = ($i % 2 );++$i;?><span class="" style="display: block;"><?php echo ($record["text"]); ?></span><?php endforeach; endif; else: echo "" ;endif; ?>
                                <?php else: ?>
                                    <span>无记录</span><?php endif; ?>
                            </div>
                        </div>
    
                        <div class='<?php if(($_GET["type"]) == "check"): ?>disable<?php endif; ?>'>
                            <?php if(($info["id"]) > "0"): ?><div class="hr-line-dashed"></div>
                
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">推荐</label>
                                    <div class="col-sm-10">
                                        <?php $_result=C('DOCUMENT_POSITION');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$position): $mod = ($i % 2 );++$i;?><label class="checkbox-inline">
                                                <input type="checkbox" value="<?php echo ($key); ?>" name="position[]" style="height: 25px;" <?php if(check_position($info['position'],$key)): ?>checked="checked"<?php endif; ?>>
                                                <?php echo ($position); ?>
                                            </label><?php endforeach; endif; else: echo "" ;endif; ?>
                                        <span class="help-block m-b-none">设置推荐位</span>
                                    </div>
                                </div><?php endif; ?>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input name="title" type="text" class="form-control" value="<?php echo ((isset($info["title"]) && ($info["title"] !== ""))?($info["title"]):''); ?>">
                                    <span class="help-block m-b-none">填写培训机构名称</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">地区</label>
                
                                <div class="col-sm-10">
                                    <select name="did" class="form-control m-b" name="account">
                                        <?php if(is_array($districts)): $i = 0; $__LIST__ = $districts;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$district): $mod = ($i % 2 );++$i;?>0
                                            <option value="<?php echo ($district["id"]); ?>" <?php if(($district['id']) == $info['did']): ?>selected<?php endif; ?>><?php echo ($district["title"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>
                                    <span class="help-block m-b-none">选择培训机构所属地区</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">地址</label>
                                <div class="col-sm-10">
                                    <input name="address" type="text" class="form-control" value="<?php echo ((isset($info["address"]) && ($info["address"] !== ""))?($info["address"]):''); ?>">
                                    <span class="help-block m-b-none">填写培训机构地址</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">电话</label>
                                <div class="col-sm-10">
                                    <input name="phone" type="text" class="form-control" value="<?php echo ((isset($info["phone"]) && ($info["phone"] !== ""))?($info["phone"]):''); ?>">
                                    <span class="help-block m-b-none">填写培训机构的联系电话</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">简介</label>
                                <div class="col-sm-10">
                                    <textarea name="description" class="form-control" rows="4"><?php echo ((isset($info["description"]) && ($info["description"] !== ""))?($info["description"]):''); ?></textarea>
                                    <span class="help-block m-b-none">填写培训机构的简介</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">详情</label>
                                <div class="col-sm-10">
                                    <textarea id="content" name="content" style="width:100%;height:240px;"><?php echo ($info['content']); ?></textarea>
                                    <link href="/static/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
                                    <script type="text/javascript" src="/static/umeditor/third-party/template.min.js"></script>
                                    <!-- 配置文件 -->
                                    <script type="text/javascript" src="/static/umeditor/umeditor.config.js"></script>
                                    <!-- 编辑器源码文件 -->
                                    <script type="text/javascript" src="/static/umeditor/umeditor.min.js"></script>
                                    <script type="text/javascript" src="/static/umeditor/lang/zh-cn/zh-cn.js"></script>
                                    <!-- 实例化编辑器 -->
                                    <script type="text/javascript">
                                        //实例化编辑器
                                        var um_content = UM.getEditor('content',{
                                            imageUrl:"<?php echo U('File/editor');?>",
                                            imagePath:""
                                        });
                                    </script>
                                    <span class="help-block m-b-none">填写培训机构的详情</span>
                                </div>
                            </div>
            
                            <div class="hr-line-dashed"></div>
        
    
                        </div>
        
                        <input type="hidden" name="id" value="<?php echo ((isset($info["id"]) && ($info["id"] !== ""))?($info["id"]):''); ?>"/>
        
        
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存内容</button>
                                <button class="btn btn-white" type="submit" onclick="window.history.go(-1);">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
<!--<script src="/Admin/js/jquery.min.js?v=2.1.4"></script>-->
<script src="/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/Admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/Admin/js/plugins/layer/layer.min.js"></script>
<script src="/Admin/js/hplus.min.js?v=4.1.0"></script>
<script src="/Admin/js/contabs.min.js"></script>
<script src="/Admin/js/plugins/pace/pace.min.js"></script>
<script>
    $("button").on('click',function(){
        if ( $(this).hasClass("confirm") ) {
            if ( !confirm("确定要执行操作吗?") ) {
                console.log("取消操作");
                return;
            } else {
                console.log("继续操作");
            }
        }
        var href = $(this).attr("href");
        var form = $(this).attr("form");
        var action = $(this).attr("action");
        if ( href ){
            window.location.href = href;
        } else if ( form && action ) {
            $("#"+form)
                .attr("action",action)
                .submit();
        }
    });

    $("input[name=checkAll]").on('change',function(){
        console.log("改变了");
        console.log($(this).prop("checked"));
        var child = $(this).attr("child");
        if ( $(this).prop("checked") ) {
            $("."+child).prop("checked",true);
        } else {
            $("."+child).prop("checked",false);
        }
    });

</script>

<script src="/Admin/js/content.min.js?v=1.0.0"></script>
<script src="/Admin/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    $(function(){
        var disable = $(".disable"),
            inputs = disable.find("input"),
            radios = disable.find("radio"),
            selects = disable.find("select"),
            checkboxs = disable.find("checkbox"),
            textareas = disable.find("textarea"),
            editors = disable.find(".edui-body-container"),
            others = disable.find("*");
        console.log(editors);
        disable.hide();
        disable.css({cursor:'not-allowed'});
        inputs.attr("disabled","disabled");
        radios.attr("disabled","disabled");
        checkboxs.attr("disabled","disabled");
        selects.attr("disabled","disabled");
        textareas.attr("disabled","disabled");
        editors.attr("contenteditable","false");
        others.css({"cursor":'not-allowed'});
    });
</script>
</body>
</html>